package controller

import (
	"encoding/json"
	"fmt"
	"io"
	"net/http"

	"gitee.com/shuwenhe/shuwen/encoding/json/encode.go/Marshal2/model"
)

func GetTVShow(w http.ResponseWriter, r *http.Request) {
	tvShow := model.TVShow{
		Title:  "三个火枪手",
		Year:   2021,
		Price:  59,
		Actors: []string{"达达尼亚", "简"},
	}
	tvString, err := json.Marshal(tvShow)
	if err != nil {
		fmt.Println("json marshal error :", err)
		return
	}
	fmt.Printf("tvString:%s\n", tvString)
	io.WriteString(w, string(tvString))
}
